package com.bootdo.analyze.controller;

import com.bootdo.analyze.domain.ClientSellAIDO;
import com.bootdo.analyze.domain.SellOrderDO;
import com.bootdo.analyze.service.ClientSellAIService;
import com.bootdo.analyze.service.SellOrderService;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 *
 * 
 * @author chglee
 * @email 1992lcg@163.com
 * @date 2020-03-02 10:02:27
 */
 
@Controller
@RequestMapping("/analyze/orderform")
public class SellOrderController {
	@Autowired
	private SellOrderService sellOrderService;


	/**
	 * 销售明细报表
	 * @return
	 */
	@GetMapping("/sellorder")
	@RequiresPermissions("analyze:salesstatement:salesorderform")
	String clientFluctuate(){
		return "analyze/salesstatement/salesorderform";
	}

	@ResponseBody
	@GetMapping("/salesorderlist")
	@RequiresPermissions("analyze:salesstatement:salesorderform")
	public PageUtils clienList(@RequestParam Map<String, Object> params){
		//查询列表数据
		Query query = new Query(params);
		List<SellOrderDO> goodsList = sellOrderService.getSellOrder(query);
		int total = sellOrderService.count(query);
		PageUtils pageUtils = new PageUtils(goodsList, total);
		return pageUtils;
	}


	/**
	 * 业绩报表
	 * @return
	 */
	@GetMapping("/businessform")
	@RequiresPermissions("analyze:financeform:businessform")
	String businessForm(){
		return "analyze/financeform/businessform";
	}

	@ResponseBody
	@GetMapping("/businessformlist")
	@RequiresPermissions("analyze:financeform:businessform")
	public PageUtils businessFormList(@RequestParam Map<String, Object> params){
		//查询列表数据
		Query query = new Query(params);
		List<SellOrderDO> goodsList = sellOrderService.getSellReport(query);
		int total = goodsList.size();
		PageUtils pageUtils = new PageUtils(goodsList, total);
		return pageUtils;
	}








}
